package com.example.expresscabinet.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.expresscabinet.model.friend;
import com.example.expresscabinet.model.friendetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface friendMapper extends BaseMapper<friend> {

    @Select("select * " +
            "from friend " +
            "where code=#{code}")
    List<friend> queryAllFriend(@Param("code") String code);

    @Select("select num,code,tel,intime,outtime,cost " +
            "from getexpress natural join friend " +
            "where receiver=#{receiver} and states=#{states}")
    Page<friendetail> queryNotake(Page page, @Param("receiver") String receiver,@Param("states") String states);


    @Select("select num,code,tel,intime,outtime,cost " +
            "from getexpress natural join friend " +
            "where receiver=#{receiver} and states=#{states} and taker=#{receiver}")
    Page<friendetail> queryTake(Page page, @Param("receiver") String receiver,@Param("states") String states);

}
